

#include "LinearWaveKernel.h"
#include "VFVProblem.h"
#include "ReconstructionSystem.h"

registerMooseObject("O4App", LinearWaveKernel);

template <>
InputParameters
validParams<LinearWaveKernel>()
{
  InputParameters params = validParams<Kernel>();
  
  return params;
}

LinearWaveKernel::LinearWaveKernel(const InputParameters & parameters)
  : Kernel(parameters),
  _vfv_problem(* getCheckedPointerParam<VFVProblem*>("_vfv_problem"))
{
}

Real
LinearWaveKernel::computeQpResidual()
{
	auto rs_sys = _vfv_problem.getReconstructionSystem();
	//rs_sys->reinitElem(_current_elem, _tid);
	auto& u_rs = rs_sys->getFieldVariable<Real>(0, "u_rs");
	//u_rs.computeElemValues();
	auto& sln = u_rs.sln();
	//std::cout << sln.size() << std::endl;

	//std::cout << sln[0] << " " << _u[0] << std::endl;
	RealGradient _velocity = RealGradient(1, 0, 0);
    RealGradient u = RealGradient(_u[_qp],0,0);
	//std::cout << _u[_qp] << std::endl;
	//auto rs_sys = _vfv_problem.getReconstructionSystem();
    return -u*_grad_test[_i][_qp];
}

Real
LinearWaveKernel::computeQpJacobian()
{
	return 0;

	//RealGradient _velocity = RealGradient(1, 0, 0);
	//RealGradient u = RealGradient(_phi[_qp][_j], 0, 0);
 //   return -u * _grad_test[_i][_qp];
}

